#include "quote.h"
#include <string.h>
int nReq;

Quote::Quote(void)
{
	_FrontConnected = NULL;
	_FrontDisconnected = NULL;
	_RspDepthMarketDataSubscribe = NULL;
	_RspDepthMarketDataCancel = NULL;
	_RtnDepthMarketData = NULL;
	
}

DLL_EXPORT_C_DECL void WINAPI qSetOnFrontConnected(Quote* spi, void* func){spi->_FrontConnected = func;}
DLL_EXPORT_C_DECL void WINAPI qSetOnFrontDisconnected(Quote* spi, void* func){spi->_FrontDisconnected = func;}
DLL_EXPORT_C_DECL void WINAPI qSetOnRspDepthMarketDataSubscribe(Quote* spi, void* func){spi->_RspDepthMarketDataSubscribe = func;}
DLL_EXPORT_C_DECL void WINAPI qSetOnRspDepthMarketDataCancel(Quote* spi, void* func){spi->_RspDepthMarketDataCancel = func;}
DLL_EXPORT_C_DECL void WINAPI qSetOnRtnDepthMarketData(Quote* spi, void* func){spi->_RtnDepthMarketData = func;}

DLL_EXPORT_C_DECL void* WINAPI qCreateApi(){return NewMdApi("./log/");}
DLL_EXPORT_C_DECL void* WINAPI qCreateSpi(){return new Quote();}
DLL_EXPORT_C_DECL void* WINAPI qGetVersion() { return (void*)GetMdApiVersion(); }

DLL_EXPORT_C_DECL void* WINAPI qReleaseApi(CHSMdApi *api){api->ReleaseApi(); return 0;}
DLL_EXPORT_C_DECL void* WINAPI qInit(CHSMdApi *api, const char *pszLicFile, const char *pszSafeLevel, const char *pszPwd, const char *pszSslFile, const char *pszSslPwd){api->Init(pszLicFile, pszSafeLevel, pszPwd, pszSslFile, pszSslPwd); return 0;}
DLL_EXPORT_C_DECL void* WINAPI qJoin(CHSMdApi *api){api->Join(); return 0;}
DLL_EXPORT_C_DECL void* WINAPI qRegisterFront(CHSMdApi *api, const char *pszFrontAddress){api->RegisterFront(pszFrontAddress); return 0;}
DLL_EXPORT_C_DECL void* WINAPI qRegisterFensServer(CHSMdApi *api, const char *pszFensAddress, const char *pszAccountID){api->RegisterFensServer(pszFensAddress, pszAccountID); return 0;}
DLL_EXPORT_C_DECL void* WINAPI qRegisterSpi(CHSMdApi *api, CHSMdSpi *pSpi){api->RegisterSpi(pSpi); return 0;}
DLL_EXPORT_C_DECL void* WINAPI qReqDepthMarketDataSubscribe(CHSMdApi *api, CHSReqDepthMarketDataField pReqDepthMarketDataSubscribe[], int nCount, int nRequestID){api->ReqDepthMarketDataSubscribe(pReqDepthMarketDataSubscribe, nCount, nRequestID); return 0;}
DLL_EXPORT_C_DECL void* WINAPI qReqDepthMarketDataCancel(CHSMdApi *api, CHSReqDepthMarketDataField pReqDepthMarketDataCancel[], int nCount, int nRequestID){api->ReqDepthMarketDataCancel(pReqDepthMarketDataCancel, nCount, nRequestID); return 0;}

